import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Comida here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Comida extends Bonus
{
    /**
     * Act - do whatever the Comida wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
     private GreenfootImage c1=new GreenfootImage("Comida1.png");
     private GreenfootImage c2=new GreenfootImage("Comida2.png");
       
    public void act() 
    { 
        Actor stickman= getOneIntersectingObject(Stickman.class);    
        
         if(stickman!=null){ 
            World aux=getWorld();
             getWorld().addObject(new Animaciones(7), getX()+10, getY()-5);
           ((StickmanWorld)aux).creaLetrero(4,2);
            
            ((StickmanWorld)aux).ReduceAumentaEnergia(false);           
            getWorld().removeObject(this);
            return;
        }
        
        
         num++;
         if(num==100){setImage(c1);}
         if(num==200){setImage(c2);}
         if(num==250){getWorld().removeObject(this);}
        
        
    }    
    public Comida(){num=0;}
    
    
    
    
    
           
        
}
